﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RanchBuddy.Core.Domain;
using RanchBuddy.Core.Domain.Impl;
using StructureMap;

namespace RanchBuddy.Core.DataAccess.Impl
{
    [Pluggable("Default")]
    public class TermsRepository : ITermsRepository
    {
        public static Term GetLatestTerms()
        {
            Term result = new Term();
            using (RanchBuddyDataContext dc = ObjectFactory.GetInstance<IConnection>().GetLsContext())
            {
                result = dc.Terms.OrderByDescending(t => t.TermID).FirstOrDefault();
            }
            return result;
        }
    }
}
